package com.playball.lottery.customview;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.playball.lottery.R;
//import com.playball.lottery.frm.buyhall.JddJCZQActivity;
import com.playball.lottery.frm.buyhall.JcfootballActivity;
import com.playball.lottery.util.DateUtil;


/**
 * 竞彩足球购彩选号操作界面数据适配器
 * 
 * @author Administrator
 * 
 */
public class BaseGroupAdapter extends BaseExpandableListAdapter {
	
	private int groupIndex = -1;
	private int childIndex = -1;

	/** 定义一个内部类，用于保存父View */
	class GroupExpandableListHolder {
		TextView title;
		ImageView indicator;
	}

	/** 定义一个内部类，用于保存子View,让球胜平负和胜平负使用 */
	class ChildExpandableListHolderRQSPF {
		TextView tv_item_no_endtime, tv_matchname,tv_week;
		TextView tv_hteam,tv_vteam,tv_item_vs_or_rq,tv_item_match_issingle;
		Button btn_s , btn_s_02;
		Button btn_p ,btn_p_02 ;
		Button btn_f, btn_f_02;
		TextView tv_hteam_name_01,tv_hteam_name_02 ;
		View linearLayout01;
	}

	/** 定义一个内部类，用于保存子View,半全场使用 */
	class ChildExpandableListHolderBQC {
		TextView tv_item_no_endtime, tv_matchname, tv_hteam, tv_vteam,tv_item_match_issingle;
		Button button01;
		LinearLayout llBQCGridview;
		JczqGridview bqcGridview;
		JczqBqcgridviewAdapter myBQCGridAdapter;
	}

	/** 定义一个内部类，用于保存子View,总进球使用 */
	class ChildExpandableListHolderZJQ {
		TextView tv_item_no, tv_matchname, tv_hteam,tv_vteam, tv_item_endtime,tv_item_match_issingle;
		JczqGridview zjqGridView;
		JczqZJQGridviewAdapter myZJQGridAdapter;
	}

	/** 定义一个内部类，用于保存子View,比分使用 */
	class ChildExpandableListHolderBF {
		TextView tv_item_no_endtime, tv_matchname, tv_hteam,tv_vteam,tv_item_match_issingle;
		Button button01;
		Button button02;
		Button button03;

		LinearLayout llBFSGridview;
		JczqGridview bFSGridview;
		JczqBfgridviewAdapter bFSGridAdapter;

		LinearLayout llBFPGridview;
		JczqGridview bFPGridview;
		JczqBfgridviewAdapter bFPGridAdapter;

		LinearLayout llBFFGridview;
		JczqGridview bFFGridview;
		JczqBfgridviewAdapter bFFGridAdapter;
	}
	
	/** 定义一个内部类，用于保存子View,单关配使用 */
	class ChildExpandableListHolderYZJS {
		TextView tv_item_no_endtime, tv_matchname, tv_hteam,tv_vteam;
		Button btn_s;
		Button btn_p;
		Button btn_f;
		Button btn_rqs;
		Button btn_rqp;
		Button btn_rqf;
		Button btn_rq1;
		Button btn_rq2;
		
		
	}

	private String ZQWF;
	private Context context; // 父activity
	private LayoutInflater mChildInflater; // 用于加载listitem的布局xml
	private LayoutInflater mGroupInflater; // 用于加载group的布局xml
	private List<GroupDTO> groups; // 所有group
	private ArrayList<ChildDTO> list_children = new ArrayList<ChildDTO>();// 零时存储选择的赛事，由JcfootballActivity来回调

	/**
	 * 构造方法
	 * 
	 * @param c
	 *            － activity
	 * @param groups
	 *            － 所有group
	 */

	public BaseGroupAdapter(Context c, List<GroupDTO> groups) {
		context = c;
		mChildInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mGroupInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.groups = groups;
	}

	public BaseGroupAdapter(Context c, List<GroupDTO> groups, String strZQWF) {
		context = c;
		mChildInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mGroupInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.groups = groups;
		ZQWF = strZQWF;
	}

	public void addChildData(int groupId,ChildDTO dto){
		groups.get(groupId).children.add(dto);
		notifyDataSetChanged();
	}
	
	@Override
	public Object getChild(int arg0, int arg1) {// 根据组索引和item索引，取得listitem //
		return groups.get(arg0).children.get(arg1);
	}

	@Override
	public long getChildId(int arg0, int arg1) {// 返回item索引
		return arg1;
	}

	@Override
	public int getChildrenCount(int groupPosition) {// 根据组索引返回分组的子item数
		if (groups.size() <= 0)
			return 0;
		else
			return groups.get(groupPosition).children.size();
	}

	@Override
	public Object getGroup(int groupPosition) {// 根据组索引返回组
		return groups.get(groupPosition);
	}

	@Override
	public int getGroupCount() {// 返回分组数
		return groups.size();
	}

	@Override
	public long getGroupId(int groupPosition) {// 返回分组索引
		return groupPosition;
	}

	@Override
	public View getGroupView(int position, boolean isExpanded, View view, ViewGroup parent) {// 根据组索引渲染"组视图"
		GroupExpandableListHolder holder = null; // 清空临时变量holder
		if (view == null) { 
			view = mGroupInflater.inflate(R.layout.item_group, null);
			holder = new GroupExpandableListHolder();
			holder.title = (TextView) view.findViewById(R.id.item_group_title);
			holder.indicator = (ImageView) view.findViewById(R.id.item_group_status);
			view.setTag(holder);
		} else {
			holder = (GroupExpandableListHolder) view.getTag();
		}
		GroupDTO info = this.groups.get(position);
		if (info != null) {
			holder.title.setText(DateUtil.getTName(info.title));
		}
		if (isExpanded) {
			holder.indicator.setImageResource(R.drawable.hemai_up);
		} else {
			holder.indicator.setImageResource(R.drawable.hemai_down);
		}
		return view;
	}

	@Override
	public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
		if (ZQWF.equals("RQSPF") || (ZQWF.equals("SPF"))) {
			ChildExpandableListHolderRQSPF holderRQSPF = null; // 让球胜平负和胜平负清空临时变量
//			if (convertView == null) { // 若行未初始化
				// 通过flater初始化行视图
				convertView = mChildInflater.inflate(R.layout.ui_new_jczq_item, null);
				// 并将行视图的5个子视图引用放到tag中
				holderRQSPF = new ChildExpandableListHolderRQSPF();
				holderRQSPF.tv_item_no_endtime = (TextView) convertView.findViewById(R.id.tv_item_no_endtime);
				holderRQSPF.tv_matchname = (TextView) convertView.findViewById(R.id.tv_item_match_name);
				holderRQSPF.tv_hteam = (TextView) convertView.findViewById(R.id.tv_item_hteam);
				holderRQSPF.tv_vteam = (TextView) convertView.findViewById(R.id.tv_item_vteam);
				holderRQSPF.tv_item_vs_or_rq = (TextView) convertView.findViewById(R.id.tv_item_vs_or_rq);
				holderRQSPF.btn_s = (Button) convertView.findViewById(R.id.btn_item_s);
				holderRQSPF.btn_p = (Button) convertView.findViewById(R.id.btn_item_p);
				holderRQSPF.btn_f = (Button) convertView.findViewById(R.id.btn_item_f);
				holderRQSPF.linearLayout01 = convertView.findViewById(R.id.linearLayout01);
				holderRQSPF.tv_item_match_issingle = (TextView) convertView.findViewById(R.id.tv_item_match_issingle);
//				int i = childPosition / 2 % 2;
//				if(i == 0) {
//					holderRQSPF.linearLayout01.setBackgroundColor(Color.parseColor("#9acef3"));
//				} else {
				//	holderRQSPF.linearLayout01.setBackgroundColor(Color.parseColor("#ffcccc"));
//				}
//				convertView.setTag(holderRQSPF);
//			} else { // 若行已初始化，直接从tag属性获得子视图的引用
//				holderRQSPF = (ChildExpandableListHolderRQSPF) convertView.getTag();
//			}
			// 获得行数据（模型）
			final ChildDTO info = this.groups.get(groupPosition).children.get(childPosition);
			if (info != null) {
				String str_eq = "";
				String str_nmu = "";
				holderRQSPF.tv_item_match_issingle.setVisibility(info.isSingle()==1 ? View.VISIBLE:View.INVISIBLE);
				// 根据模型数据，设置行视图的控件值
				if (!info.eQ.equals("0")) {
					str_eq = info.eQ;
				}else{
					str_eq = "-";
				}
				if (info.nMm.length() < 4) {
					str_nmu = info.nMm;
				} else {
					str_nmu = info.nMm.substring(0, 4);
				}
				String vs = "VS";
//				holderRQSPF.textView_wk.setText(DateUtil.getGameNo(info.mId));
				//格式修改 130909001  截取后3位001
				holderRQSPF.tv_item_no_endtime.setText(info.mId.substring(info.mId.length()-3, info.mId.length())+" "+DateUtil.getDateTime1(info.eTime));
				holderRQSPF.tv_matchname.setText(str_nmu);
				// 胜平负不显示让球
				if (ZQWF.equals("RQSPF")) {
					holderRQSPF.tv_hteam.setText(info.hTeam);
					holderRQSPF.tv_vteam.setText(info.vTeam);
					//holderRQSPF.tv_item_vs_or_rq.setTextColor(0xfff54551);
					holderRQSPF.tv_item_vs_or_rq.setText(str_eq);
					/*holderRQSPF.btn_s.setText("胜" + info.sPRqspf.split("-")[0]);
					holderRQSPF.btn_p.setText("平" + info.sPRqspf.split("-")[1]);
					holderRQSPF.btn_f.setText("负" + info.sPRqspf.split("-")[2]);*/
					
					if (info.str_sbtn) {
						holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.hTeam  + "</font><br>"  + "胜" ) );
					}else {
						holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.hTeam  + "</font><br>"  +  "胜" ) );
					}
					
					holderRQSPF.tv_hteam.setText(info.sPRqspf.split("-")[0]);
					
					if (info.str_pbtn) {
						holderRQSPF.btn_p.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ str_eq  + "</font><br>"  + "平" ) );
					}else {
						holderRQSPF.btn_p.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ str_eq  + "</font><br>"  +  "平" ));
					}
					holderRQSPF.tv_item_vs_or_rq.setText(info.sPRqspf.split("-")[1]);
					
					
					if (info.str_fbtn) {
						holderRQSPF.btn_f.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.vTeam  + "</font><br>"  + "胜" ) );
					}else {
						holderRQSPF.btn_f.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.vTeam  + "</font><br>"  +  "胜" ));
					}
					
					holderRQSPF.tv_vteam.setText(info.sPRqspf.split("-")[2]);
					
				} else {
					holderRQSPF.tv_hteam.setText(info.hTeam);
					holderRQSPF.tv_vteam.setText(info.vTeam);
					if(!info.getsPspf().equals("")){
						if (info.str_sbtn) {
							holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.hTeam  + "</font><br>"  + "胜" ) );
						}else {
							holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.hTeam  + "</font><br>"  +  "胜" ));
						}
						holderRQSPF.tv_hteam.setText(info.getsPspf().split("-")[0]);
						
						if (info.str_pbtn) {
							holderRQSPF.btn_p.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ vs  + "</font><br>"  + "平" ) );
						}else {
							holderRQSPF.btn_p.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ vs  + "</font><br>"  +  "平" ));
						}
						holderRQSPF.tv_item_vs_or_rq.setText( info.getsPspf().split("-")[1]);
						
						if (info.str_fbtn) {
							holderRQSPF.btn_f.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.vTeam  + "</font><br>"  + "胜" ) );
						}else {
							holderRQSPF.btn_f.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.vTeam  + "</font><br>"  +  "胜"));
						}
						holderRQSPF.tv_vteam.setText( info.getsPspf().split("-")[2]);
						//holderRQSPF.btn_s.setText("胜" + info.getsPspf().split("-")[0]);
						//holderRQSPF.btn_p.setText("平" + info.getsPspf().split("-")[1]);
						//holderRQSPF.btn_f.setText("负" + info.getsPspf().split("-")[2]);
					}else{
						holderRQSPF.btn_s.setText("胜" + "-");
						holderRQSPF.btn_p.setText("平" + "-");
						holderRQSPF.btn_f.setText("胜" + "-");
					}
				}

				holderRQSPF.btn_s.setSelected(info.str_sbtn);
				holderRQSPF.btn_s.setTag(info);

				holderRQSPF.btn_p.setSelected(info.str_pbtn);
				holderRQSPF.btn_p.setTag(info);

				holderRQSPF.btn_f.setSelected(info.str_fbtn);
				holderRQSPF.btn_f.setTag(info);
				
				

				holderRQSPF.btn_s.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button01 = (Button) v;
						ChildDTO child_info1 = (ChildDTO) v.getTag();
						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
						// 用来装需要删除的彩豆素
						List delList = new ArrayList();
						for (ChildDTO child : list_children) {
							String jc_mid = child.getmId();
							if (child_info1.getmId() == jc_mid) {
								delList.add(child);
							}
						}
						list_children.removeAll(delList);
						// 判断赋新选中的值
						if (child_info1.str_sbtn) {
							if (ZQWF.equals("RQSPF")) {
								child_info1.setStr_sp(child_info1.str_sp.replace("3," + info.sPRqspf.split("-")[0] + "/", ""));
								child_info1.str_sbtn = false;
								button01.setSelected(child_info1.str_sbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info1.setStr_sp(child_info1.str_sp.replace("3," + info.getsPspf().split("-")[0] + "/", ""));
									child_info1.str_sbtn = false;
									button01.setSelected(child_info1.str_sbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
								
							}
							
						} else {
							if (child_info1.str_sp == null) {
								child_info1.str_sp = "";
							}
							if (ZQWF.equals("RQSPF")) {
								child_info1.setStr_sp(child_info1.str_sp + "3," + info.sPRqspf.split("-")[0] + "/");
								child_info1.str_sbtn = true;
								button01.setSelected(child_info1.str_sbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info1.setStr_sp(child_info1.str_sp + "3," + info.getsPspf().split("-")[0] + "/");
									child_info1.str_sbtn = true;
									button01.setSelected(child_info1.str_sbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
								
							}
							
						}
						// 判断str_sp是否为空，空的话就不回传赋值
						// 再存入List
						list_children.add(child_info1);

						// 回调initMapData这个方法，转存到全局变量里，选号结束
						((JcfootballActivity) context).initMapData(list_children,"RQSPF");

					}
				});
				holderRQSPF.btn_p.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button02 = (Button) v;
						ChildDTO child_info2 = (ChildDTO) v.getTag();
						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
						// 用来装需要删除的彩豆素
						List delList = new ArrayList();
						for (ChildDTO child : list_children) {
							String jc_mid = child.getmId();
							if (child_info2.getmId() == jc_mid) {
								delList.add(child);
							}
						}
						list_children.removeAll(delList);
						// 判断赋新的值
						if (child_info2.str_pbtn) {
							if (ZQWF.equals("RQSPF")) {
								child_info2.setStr_sp(child_info2.str_sp.replace("1," + info.sPRqspf.split("-")[1] + "/", ""));
								child_info2.str_pbtn = false;
								button02.setSelected(child_info2.str_pbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info2.setStr_sp(child_info2.str_sp.replace("1," + info.getsPspf().split("-")[1] + "/", ""));
									child_info2.str_pbtn = false;
									button02.setSelected(child_info2.str_pbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
							}
						} else {
							if (child_info2.str_sp == null) {
								child_info2.str_sp = "";
							}
							if (ZQWF.equals("RQSPF")) {
								child_info2.setStr_sp(child_info2.str_sp + "1," + info.sPRqspf.split("-")[1] + "/");
								child_info2.str_pbtn = true;
								button02.setSelected(child_info2.str_pbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info2.setStr_sp(child_info2.str_sp + "1," + info.getsPspf().split("-")[1] + "/");
									child_info2.str_pbtn = true;
									button02.setSelected(child_info2.str_pbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
							}
						}
						// 再存入List
						list_children.add(child_info2);
						// 回调initMapData这个方法，转存到全局变量里，选号结束
						((JcfootballActivity) context).initMapData(list_children,"RQSPF");

					}
				});
				holderRQSPF.btn_f.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button03 = (Button) v;
						ChildDTO child_info3 = (ChildDTO) v.getTag();
						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
						// 用来装需要删除的彩豆素
						List delList = new ArrayList();
						for (ChildDTO child : list_children) {
							String jc_mid = child.getmId();
							if (child_info3.getmId() == jc_mid) {
								delList.add(child);
							}
						}
						list_children.removeAll(delList);
						// 判断赋新的值
						if (child_info3.str_fbtn) {
							// child_info3.setStr_sp(child_info3.str_sp.replace("0/",
							// ""));
							if (ZQWF.equals("RQSPF")) {
								child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.sPRqspf.split("-")[2] + "/", ""));
								child_info3.str_fbtn = false;
								button03.setSelected(child_info3.str_fbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.getsPspf().split("-")[2] + "/", ""));
									child_info3.str_fbtn = false;
									button03.setSelected(child_info3.str_fbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
//								child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.getsPspf().split("-")[2] + "/", ""));
							}

//							child_info3.str_fbtn = false;
//							button03.setSelected(child_info3.str_fbtn);
						} else {
							if (child_info3.str_sp == null) {
								child_info3.str_sp = "";
							}
							// child_info3.setStr_sp(child_info3.str_sp + "0/");
							if (ZQWF.equals("RQSPF")) {
								child_info3.setStr_sp(child_info3.str_sp + "0," + info.sPRqspf.split("-")[2] + "/");
								child_info3.str_fbtn = true;
								button03.setSelected(child_info3.str_fbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info3.setStr_sp(child_info3.str_sp + "0," + info.getsPspf().split("-")[2] + "/");
									child_info3.str_fbtn = true;
									button03.setSelected(child_info3.str_fbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
//								child_info3.setStr_sp(child_info3.str_sp + "0," + info.getsPspf().split("-")[2] + "/");
							}

//							child_info3.str_fbtn = true;
//							button03.setSelected(child_info3.str_fbtn);
						}
						// 再存入List
						list_children.add(child_info3);
						// 回调initMapData这个方法，转存到全局变量里，选号结束
						((JcfootballActivity) context).initMapData(list_children,"RQSPF");
					}
				});
			}
		}else if((ZQWF.equals("YZJS"))){
			ChildExpandableListHolderRQSPF holderRQSPF = null; // 让球胜平负和胜平负清空临时变量
//			if (convertView == null) { // 若行未初始化
				// 通过flater初始化行视图
				convertView = mChildInflater.inflate(R.layout.jczq_yzjs_item, null);
				// 并将行视图的5个子视图引用放到tag中
				holderRQSPF = new ChildExpandableListHolderRQSPF();
				holderRQSPF.tv_item_no_endtime = (TextView) convertView.findViewById(R.id.tv_item_no_endtime);
				holderRQSPF.tv_matchname = (TextView) convertView.findViewById(R.id.tv_item_match_name);
				holderRQSPF.tv_week = (TextView) convertView.findViewById(R.id.week);
				holderRQSPF.tv_hteam = (TextView) convertView.findViewById(R.id.tv_item_hteam);
				holderRQSPF.tv_vteam = (TextView) convertView.findViewById(R.id.tv_item_vteam);
				holderRQSPF.tv_item_vs_or_rq = (TextView) convertView.findViewById(R.id.tv_item_vs_or_rq);
				holderRQSPF.btn_s = (Button) convertView.findViewById(R.id.btn_item_s);
				holderRQSPF.btn_p = (Button) convertView.findViewById(R.id.btn_item_p);
				holderRQSPF.btn_f = (Button) convertView.findViewById(R.id.btn_item_f);
				
				holderRQSPF.linearLayout01 = convertView.findViewById(R.id.linearLayout01);
//				int i = childPosition / 2 % 2;
//				if(i == 0) {
//					holderRQSPF.linearLayout01.setBackgroundColor(Color.parseColor("#9acef3"));
//				} else {
					//holderRQSPF.linearLayout01.setBackgroundColor(Color.parseColor("#ffcccc"));
//				}
//				convertView.setTag(holderRQSPF);
//			} else { // 若行已初始化，直接从tag属性获得子视图的引用
//				holderRQSPF = (ChildExpandableListHolderRQSPF) convertView.getTag();
//			}
			// 获得行数据（模型）
			final ChildDTO info = this.groups.get(groupPosition).children.get(childPosition);
			holderRQSPF.tv_week.setText("周"+info.week);
			if (info != null) {
				String str_eq = "";
				String str_nmu = "";
				// 根据模型数据，设置行视图的控件值
				if (!info.eQ.equals("0")) {
					str_eq = info.eQ;
				}else{
					str_eq = "-";
				}
				if (info.nMm.length() < 4) {
					str_nmu = info.nMm;
				} else {
					str_nmu = info.nMm.substring(0, 4);
				}

//				holderRQSPF.textView_wk.setText(DateUtil.getGameNo(info.mId));
				String vs = "VS";
				//格式修改 130909001  截取后3位001
				holderRQSPF.tv_item_no_endtime.setText(info.mId.substring(info.mId.length()-3, info.mId.length())+" "+DateUtil.getDateTime1(info.eTime));
				holderRQSPF.tv_matchname.setText(str_nmu);
					holderRQSPF.tv_hteam.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.hTeam  + "</font></b>" + "<font size='15dip' color='#fe5052'>4</font>") );
					holderRQSPF.tv_vteam.setText(info.vTeam);
					if(!info.getsPspf().equals("")){
						
						//holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.hTeam  + "</font><br>"  + "胜" + String.format("%.2f", ((Float.valueOf(info.getsPspf().split("-")[0]))*0.9))  ));
						if (info.str_sbtn) {
							holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.hTeam  + "</font><br>"  + "胜"  ));
						}else {
							holderRQSPF.btn_s.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.hTeam  + "</font><br>"  + "胜"   ));
						}
						
						holderRQSPF.tv_hteam.setText(String.format("%.2f", ((Float.valueOf(info.getsPspf().split("-")[0]))*0.9)));
						
						if (info.str_pbtn) {
							holderRQSPF.btn_p.setText( Html.fromHtml("<font size='18dip' color='#ffffff'>"+ vs  + "</font><br>"  + "平"   ));
						}else {
							holderRQSPF.btn_p.setText( Html.fromHtml("<font size='18dip' color='#fe5052'>"+ vs  + "</font><br>"  + "平"     ));
						}
						
						holderRQSPF.tv_item_vs_or_rq.setText(String.format("%.2f", ((Float.valueOf(info.getsPspf().split("-")[1]))*0.9)));
						
						if (info.str_fbtn) {
							holderRQSPF.btn_f.setText(Html.fromHtml("<font size='15dip' color='#ffffff'>"+ info.vTeam  + "</font><br>" +  "胜"   ));
						}else {
							holderRQSPF.btn_f.setText(Html.fromHtml("<font size='15dip' color='#fe5052'>"+ info.vTeam  + "</font><br>" +  "胜"    ));
						}
						
						holderRQSPF.tv_vteam.setText(String.format("%.2f", ((Float.valueOf(info.getsPspf().split("-")[2]))*0.9)));
						
					}else{
						holderRQSPF.btn_s.setText("胜" + "-");
						holderRQSPF.btn_p.setText("平" + "-");
						holderRQSPF.btn_f.setText("负" + "-");
					}

				holderRQSPF.btn_s.setSelected(info.str_sbtn);
				holderRQSPF.btn_s.setTag(info);

				holderRQSPF.btn_p.setSelected(info.str_pbtn);
				holderRQSPF.btn_p.setTag(info);

				holderRQSPF.btn_f.setSelected(info.str_fbtn);
				holderRQSPF.btn_f.setTag(info);

				 
				
				holderRQSPF.btn_s.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						
						
						Button button01 = (Button) v;
						ChildDTO child_info1 = (ChildDTO) v.getTag();
						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
						// 用来装需要删除的彩豆素
						
						if(groupPosition != groupIndex || childPosition != childIndex) {
							
							for(int i = 0; i < groups.size(); i++) {
								for(int j=0; j < groups.get(i).children.size(); j++) {
									groups.get(i).children.get(j).str_sbtn = false;
									groups.get(i).children.get(j).str_pbtn = false;
									groups.get(i).children.get(j).str_fbtn = false;
								}
							}
							
						}
						
						groupIndex = groupPosition;
						childIndex = childPosition;
						
						
						int xtemp = 0;
						for(ChildDTO dto : list_children){
							if (child_info1.getmId() != dto.getmId()) {
								if (!dto.str_sp.equals("")) {
									xtemp = xtemp + 1;
								}
							}
						}
						if(xtemp > 0){
							 //清空里面数据
							child_info1.str_sp = "";
							list_children.clear();
			 
						//return;
						}
						List delList = new ArrayList();
						for (ChildDTO child : list_children) {
							String jc_mid = child.getmId();
							if (child_info1.getmId() == jc_mid) {
								delList.add(child);
							}
						}
						list_children.removeAll(delList);
						// 判断赋新选中的值
						if (child_info1.str_sbtn) {
							if (ZQWF.equals("RQSPF")) {
								
								child_info1.setStr_sp(child_info1.str_sp.replace("3," + info.sPRqspf.split("-")[0] + "/", ""));
								child_info1.str_sbtn = false;
								button01.setSelected(child_info1.str_sbtn);
							} else {
								
								if(!"".equals(info.getsPspf())){
									child_info1.setStr_sp(child_info1.str_sp.replace("3," + info.getsPspf().split("-")[0] + "/", ""));
									child_info1.str_sbtn = false;
									button01.setSelected(child_info1.str_sbtn);
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
								
							}
							
						} else {
							if (child_info1.str_sp == null) {
								child_info1.str_sp = "";
							}
								if(!"".equals(info.getsPspf())){
									child_info1.setStr_sp(child_info1.str_sp + "3," + info.getsPspf().split("-")[0] + "/");
									child_info1.str_sbtn = true;
									button01.setSelected(child_info1.str_sbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
						}
						// 判断str_sp是否为空，空的话就不回传赋值
						// 再存入List
						list_children.add(child_info1);
						// 回调initMapData这个方法，转存到全局变量里，选号结束
						((JcfootballActivity) context).initMapData(list_children,"RQSPF");

					}
				});
				holderRQSPF.btn_p.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button02 = (Button) v;
						ChildDTO child_info2 = (ChildDTO) v.getTag();
						
						if(groupPosition != groupIndex || childPosition != childIndex) {
							
							for(int i = 0; i < groups.size(); i++) {
								for(int j=0; j < groups.get(i).children.size(); j++) {
									groups.get(i).children.get(j).str_sbtn = false;
									groups.get(i).children.get(j).str_pbtn = false;
									groups.get(i).children.get(j).str_fbtn = false;
								}
							}
							
						}
						
						groupIndex = groupPosition;
						childIndex = childPosition;
						
						
						int xtemp = 0;
						for(ChildDTO dto : list_children){
							if (child_info2.getmId() != dto.getmId()) {
								if (!dto.str_sp.equals("")) {
									xtemp = xtemp + 1;
								}
							}
						}
						if(xtemp > 0){
							child_info2.str_sp = "";
							list_children.clear();
						//	return;
						}
						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
						// 用来装需要删除的彩豆素
						List delList = new ArrayList();
						for (ChildDTO child : list_children) {
							String jc_mid = child.getmId();
							if (child_info2.getmId() == jc_mid) {
								delList.add(child);
							}
						}
						list_children.removeAll(delList);
						// 判断赋新的值
						if (child_info2.str_pbtn) {
							if (ZQWF.equals("RQSPF")) {
								child_info2.setStr_sp(child_info2.str_sp.replace("1," + info.sPRqspf.split("-")[1] + "/", ""));
								child_info2.str_pbtn = false;
								button02.setSelected(child_info2.str_pbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info2.setStr_sp(child_info2.str_sp.replace("1," + info.getsPspf().split("-")[1] + "/", ""));
									child_info2.str_pbtn = false;
									button02.setSelected(child_info2.str_pbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
							}
						} else {
							if (child_info2.str_sp == null) {
								child_info2.str_sp = "";
							}
							if (ZQWF.equals("RQSPF")) {
								child_info2.setStr_sp(child_info2.str_sp + "1," + info.sPRqspf.split("-")[1] + "/");
								child_info2.str_pbtn = true;
								button02.setSelected(child_info2.str_pbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info2.setStr_sp(child_info2.str_sp + "1," + info.getsPspf().split("-")[1] + "/");
									child_info2.str_pbtn = true;
									button02.setSelected(child_info2.str_pbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
							}
						}
						// 再存入List
						list_children.add(child_info2);
						// 回调initMapData这个方法，转存到全局变量里，选号结束
						((JcfootballActivity) context).initMapData(list_children,"RQSPF");

					}
				});
				holderRQSPF.btn_f.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button03 = (Button) v;
						ChildDTO child_info3 = (ChildDTO) v.getTag();
						
						if(groupPosition != groupIndex || childPosition != childIndex) {
							
							for(int i = 0; i < groups.size(); i++) {
								for(int j=0; j < groups.get(i).children.size(); j++) {
									groups.get(i).children.get(j).str_sbtn = false;
									groups.get(i).children.get(j).str_pbtn = false;
									groups.get(i).children.get(j).str_fbtn = false;
								}
							}
							
						}
						
						groupIndex = groupPosition;
						childIndex = childPosition;
						
						
						int xtemp = 0;
						for(ChildDTO dto : list_children){
							if (child_info3.getmId() != dto.getmId()) {
								if (!dto.str_sp.equals("")) {
									xtemp = xtemp + 1;
								}
							}
						}
						if(xtemp > 0){
							child_info3.str_sp = "";
							list_children.clear();
						//	return;
						}
						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
						// 用来装需要删除的彩豆素
						List delList = new ArrayList();
						for (ChildDTO child : list_children) {
							String jc_mid = child.getmId();
							if (child_info3.getmId() == jc_mid) {
								delList.add(child);
							}
						}
						list_children.removeAll(delList);
						// 判断赋新的值
						if (child_info3.str_fbtn) {
							// child_info3.setStr_sp(child_info3.str_sp.replace("0/",
							// ""));
							if (ZQWF.equals("RQSPF")) {
								child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.sPRqspf.split("-")[2] + "/", ""));
								child_info3.str_fbtn = false;
								button03.setSelected(child_info3.str_fbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.getsPspf().split("-")[2] + "/", ""));
									child_info3.str_fbtn = false;
									button03.setSelected(child_info3.str_fbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
//								child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.getsPspf().split("-")[2] + "/", ""));
							}

//							child_info3.str_fbtn = false;
//							button03.setSelected(child_info3.str_fbtn);
						} else {
							if (child_info3.str_sp == null) {
								child_info3.str_sp = "";
							}
							// child_info3.setStr_sp(child_info3.str_sp + "0/");
							if (ZQWF.equals("RQSPF")) {
								child_info3.setStr_sp(child_info3.str_sp + "0," + info.sPRqspf.split("-")[2] + "/");
								child_info3.str_fbtn = true;
								button03.setSelected(child_info3.str_fbtn);
							} else {
								if(!"".equals(info.getsPspf())){
									child_info3.setStr_sp(child_info3.str_sp + "0," + info.getsPspf().split("-")[2] + "/");
									child_info3.str_fbtn = true;
									button03.setSelected(child_info3.str_fbtn);
									
								}else{
									Toast.makeText(context, R.string.no_sp, Toast.LENGTH_SHORT).show();
								}
//								child_info3.setStr_sp(child_info3.str_sp + "0," + info.getsPspf().split("-")[2] + "/");
							}

//							child_info3.str_fbtn = true;
//							button03.setSelected(child_info3.str_fbtn);
						}
						// 再存入List
						list_children.add(child_info3);
						// 回调initMapData这个方法，转存到全局变量里，选号结束
						((JcfootballActivity) context).initMapData(list_children,"RQSPF");
					}
				});
			}else{
				System.out.println("childPosition: "+childPosition+"  is  null");
			}
		
		}
		else if (ZQWF.equals("BQC")) {
			ChildExpandableListHolderBQC holderBQC = null; // 半全场清空临时变量
//			if (convertView == null) { // 若行未初始化
				// 通过flater初始化行视图
				convertView = mChildInflater.inflate(R.layout.ui_new_jczq_bqc_item, null);
				// 并将行视图的5个子视图引用放到tag中
				holderBQC = new ChildExpandableListHolderBQC();
				holderBQC.tv_item_no_endtime = (TextView) convertView.findViewById(R.id.tv_item_no_endtime);
				holderBQC.tv_matchname = (TextView) convertView.findViewById(R.id.tv_item_match_name);
				holderBQC.tv_hteam = (TextView) convertView.findViewById(R.id.tv_item_hteam);
				holderBQC.tv_vteam = (TextView) convertView.findViewById(R.id.tv_item_vteam);
				holderBQC.button01 = (Button) convertView.findViewById(R.id.btn_item_s);
				// 设置gridview显示与否
				holderBQC.llBQCGridview = (LinearLayout) convertView.findViewById(R.id.ll_myGridView_banqc);
				holderBQC.bqcGridview = (JczqGridview) convertView.findViewById(R.id.jczq_myGridView_banqc);
//				holderBQC.tv_item_match_issingle = (TextView) convertView.findViewById(R.id.tv_item_match_issingle);
//				convertView.setTag(holderBQC);
//			} else { // 若行已初始化，直接从tag属性获得子视图的引用
//				holderBQC = (ChildExpandableListHolderBQC) convertView.getTag();
//			}
			// 获得行数据（模型）
			final ChildDTO info = this.groups.get(groupPosition).children.get(childPosition);
			if (info != null) {
//				holderBQC.tv_item_match_issingle.setVisibility(info.isSingle()==1 ? View.VISIBLE:View.INVISIBLE);
				String str_nmu = "";
				// 根据模型数据，设置行视图的控件值
				if (info.nMm.length() < 4) {
					str_nmu = info.nMm;
				} else {
					str_nmu = info.nMm.substring(0, 4);
				}
				holderBQC.tv_item_no_endtime.setText(info.mId.substring(info.mId.length()-3, info.mId.length())+" "+DateUtil.getDateTime1(info.eTime));
				holderBQC.tv_matchname.setText(str_nmu);
				holderBQC.tv_hteam.setText(info.hTeam);
				holderBQC.tv_vteam.setText(info.vTeam);
				holderBQC.button01.setText(info.btnBQCcontent);// "点击弹出下拉列表"
				holderBQC.button01.setSelected(info.str_sbtn);
				holderBQC.button01.setTag(info);
				holderBQC.button01.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button01 = (Button) v;
						ChildDTO child_info1 = (ChildDTO) v.getTag();
						// // 判断赋新选中的值
						if (child_info1.str_sbtn) {
							child_info1.setShowBQCGrid(false);
							child_info1.str_sbtn = false;
							button01.setSelected(child_info1.str_sbtn);
						} else {
							child_info1.setShowBQCGrid(true);
							child_info1.str_sbtn = true;
							button01.setSelected(child_info1.str_sbtn);
						}
						notifyDataSetChanged();
					}
				});

				// 设置gridview显示与否
				if (info.isShowBQCGrid == false) {
					holderBQC.llBQCGridview.setVisibility(View.GONE);
				} else {
					holderBQC.llBQCGridview.setVisibility(View.VISIBLE);
				}

				// 按钮的文字
				String[] titles = new String[] { "胜胜", "胜平", "胜负", "平胜", "平平", "平负", "负胜", "负平", "负负" };
				String[] nums;
				nums = info.sPbqc.split("\\|");
				holderBQC.myBQCGridAdapter = new JczqBqcgridviewAdapter(titles, nums, context, groups, groupPosition, childPosition);
				holderBQC.bqcGridview.setAdapter(holderBQC.myBQCGridAdapter);// 设置菜单Adapter

			}

		} else if (ZQWF.equals("ZJQ")) {
			ChildExpandableListHolderZJQ holderZJQ = null; // 总进球清空临时变量
				convertView = mChildInflater.inflate(R.layout.ui_new_jczq_zjq_item, null);
				// 并将行视图的5个子视图引用放到tag中
				holderZJQ = new ChildExpandableListHolderZJQ();
				
				holderZJQ = new ChildExpandableListHolderZJQ();
				holderZJQ.tv_item_no = (TextView) convertView.findViewById(R.id.tv_item_no);
				holderZJQ.tv_item_endtime = (TextView) convertView.findViewById(R.id.tv_item_endtime);
				holderZJQ.tv_matchname = (TextView) convertView.findViewById(R.id.tv_item_match_name);
				holderZJQ.tv_hteam = (TextView) convertView.findViewById(R.id.tv_item_hteam);
				holderZJQ.tv_vteam = (TextView) convertView.findViewById(R.id.tv_item_vteam);
				holderZJQ.zjqGridView = (JczqGridview) convertView.findViewById(R.id.jczq_zjq_gridview);
//				holderZJQ.tv_item_match_issingle = (TextView) convertView.findViewById(R.id.tv_item_match_issingle);
			// 获得行数据（模型）
			final ChildDTO info = this.groups.get(groupPosition).children.get(childPosition);
			if (info != null) {
//				holderZJQ.tv_item_match_issingle.setVisibility(info.isSingle()==1 ? View.VISIBLE:View.INVISIBLE);
				String str_nmu = "";
				// 根据模型数据，设置行视图的控件值
				if (info.nMm.length() < 4) {
					str_nmu = info.nMm;
				} else {
					str_nmu = info.nMm.substring(0, 4);
				}
				//格式修改 130909001  截取后3位001
				
				holderZJQ.tv_item_no.setText(info.mId.substring(info.mId.length()-3, info.mId.length()));
				holderZJQ.tv_item_endtime.setText(""+DateUtil.getDateTime1(info.eTime));
				holderZJQ.tv_matchname.setText(str_nmu);
				// 胜平负不显示让球
				holderZJQ.tv_hteam.setText(info.hTeam);
				holderZJQ.tv_vteam.setText(info.vTeam);
				String[] nums;
//				Log.d("bg", "info.sPzjq= "+info.sPzjq);
				nums = info.sPzjq.split("\\|");//nums = info.sPzjq.split(",");
				String[] titles = new String[] { "0", "1", "2", "3", "4", "5", "6", "7+" };
				// // 开始展现
				holderZJQ.myZJQGridAdapter = new JczqZJQGridviewAdapter(titles, nums, context, groups, groupPosition, childPosition);
				holderZJQ.zjqGridView.setAdapter(holderZJQ.myZJQGridAdapter);// 设置菜单Adapter
			}
		} else if (ZQWF.equals("BF")) {
			ChildExpandableListHolderBF holderBF = null; // 比分清空临时变量
				convertView = mChildInflater.inflate(R.layout.ui_new_jczq_bf_item, null);
				// 并将行视图的5个子视图引用放到tag中
				holderBF = new ChildExpandableListHolderBF();
				
				holderBF.tv_item_no_endtime = (TextView) convertView.findViewById(R.id.tv_item_no_endtime);
				holderBF.tv_matchname = (TextView) convertView.findViewById(R.id.tv_item_match_name);
				holderBF.tv_hteam = (TextView) convertView.findViewById(R.id.tv_item_hteam);
				holderBF.tv_vteam = (TextView) convertView.findViewById(R.id.tv_item_vteam);
				holderBF.button01 = (Button) convertView.findViewById(R.id.btn_item_s);
				holderBF.button02 = (Button) convertView.findViewById(R.id.btn_item_p);
				holderBF.button03 = (Button) convertView.findViewById(R.id.btn_item_f);
				// 设置比分主胜gridview显示与否
				holderBF.llBFSGridview = (LinearLayout) convertView.findViewById(R.id.ll_myGridView_bfs);
				holderBF.bFSGridview = (JczqGridview) convertView.findViewById(R.id.myGridView_bfs);
				// 比分平gridview
				holderBF.llBFPGridview = (LinearLayout) convertView.findViewById(R.id.ll_myGridView_bfp);
				holderBF.bFPGridview = (JczqGridview) convertView.findViewById(R.id.myGridView_bfp);
				// 比分主负gridview
				holderBF.llBFFGridview = (LinearLayout) convertView.findViewById(R.id.ll_myGridView_bff);
				holderBF.bFFGridview = (JczqGridview) convertView.findViewById(R.id.myGridView_bff);
//				holderBF.tv_item_match_issingle = (TextView) convertView.findViewById(R.id.tv_item_match_issingle);
			// 获得行数据（模型）
			final ChildDTO info = this.groups.get(groupPosition).children.get(childPosition);
			if (info != null) {
//				holderBF.tv_item_match_issingle.setVisibility(info.isSingle()==1 ? View.VISIBLE:View.INVISIBLE);
				String str_nmu = "";
				// 根据模型数据，设置行视图的控件值
				if (info.nMm.length() < 4) {
					str_nmu = info.nMm;
				} else {
					str_nmu = info.nMm.substring(0, 4);
				}
				holderBF.tv_item_no_endtime.setText(info.mId.substring(info.mId.length()-3, info.mId.length())+" "+DateUtil.getDateTime1(info.eTime));
				holderBF.tv_matchname.setText(str_nmu);
				holderBF.tv_hteam.setText(info.hTeam);
				holderBF.tv_vteam.setText(info.vTeam);
				// 设置按钮文字为选择的内容
				if (info.getList_bfsgridview_selectconcent().size() <= 1) {
					holderBF.button01.setText(info.btnbfscontent);
				} else {
					holderBF.button01.setText("胜多个");
				}
				if (info.getList_bfpgridview_selectconcent().size() <= 1) {
					holderBF.button02.setText(info.btnbfpcontent);
				} else {
					holderBF.button02.setText("平多个");
				}
				if (info.getList_bffgridview_selectconcent().size() <= 1) {
					holderBF.button03.setText(info.btnbffcontent);
				} else {
					holderBF.button03.setText("负多个");
				}

				holderBF.button01.setSelected(info.str_sbtn);
				holderBF.button01.setTag(info);

				holderBF.button02.setSelected(info.str_pbtn);
				holderBF.button02.setTag(info);

				holderBF.button03.setSelected(info.str_fbtn);
				holderBF.button03.setTag(info);

				holderBF.button01.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button01 = (Button) v;
						ChildDTO child_info1 = (ChildDTO) v.getTag();
						if (child_info1.str_sbtn) {
							child_info1.setShowBFS(false);
							child_info1.str_sbtn = false;
							button01.setSelected(child_info1.str_sbtn);

						} else {
							child_info1.setShowBFS(true);
							child_info1.setShowBFP(false);
							child_info1.setShowBFF(false);
							child_info1.str_sbtn = true;
							child_info1.str_pbtn = false;
							child_info1.str_fbtn = false;

							button01.setSelected(child_info1.str_sbtn);

						}
						notifyDataSetChanged();
					}
				});

				holderBF.button02.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button02 = (Button) v;
						ChildDTO child_info2 = (ChildDTO) v.getTag();
						if (child_info2.str_pbtn) {
							// gridview不显示
							child_info2.setShowBFP(false);
							child_info2.str_pbtn = false;
							button02.setSelected(child_info2.str_pbtn);

						} else {
							// gridview显示
							child_info2.setShowBFP(true);
							child_info2.setShowBFS(false);
							child_info2.setShowBFF(false);
							child_info2.str_pbtn = true;
							child_info2.str_sbtn = false;
							child_info2.str_fbtn = false;

							button02.setSelected(child_info2.str_pbtn);

						}
						notifyDataSetChanged();
					}
				});

				holderBF.button03.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						Button button03 = (Button) v;
						ChildDTO child_info3 = (ChildDTO) v.getTag();
						if (child_info3.str_fbtn) {
							child_info3.setShowBFF(false);
							child_info3.str_fbtn = false;
							button03.setSelected(child_info3.str_fbtn);

						} else {
							// gridview不显示
							child_info3.setShowBFF(true);
							child_info3.setShowBFS(false);
							child_info3.setShowBFP(false);
							child_info3.str_fbtn = true;
							child_info3.str_sbtn = false;
							child_info3.str_pbtn = false;
							button03.setSelected(child_info3.str_fbtn);

						}
						notifyDataSetChanged();
					}
				});

				// 设置比分主胜gridview显示与否
				if (info.isShowBFS == false) {
					holderBF.llBFSGridview.setVisibility(View.GONE);
				} else {
					holderBF.llBFSGridview.setVisibility(View.VISIBLE);
				}
				// 按钮的文字
				String[] bfs_titles = new String[] { "1:0", "2:0", "2:1", "3:0", "3:1", "3:2", "4:0", "4:1", "4:2", "5:0", "5:1", "5:2", "胜其他" };
				String[] bfs_nums;
//				Log.d("bg", "info.sPbfs= "+info.sPbfs);
				bfs_nums = info.sPbfs.split("\\|");//,
				holderBF.bFSGridAdapter = new JczqBfgridviewAdapter(bfs_titles, bfs_nums, context, groups, groupPosition, childPosition, "bfs");
				holderBF.bFSGridview.setAdapter(holderBF.bFSGridAdapter);// 设置菜单Adapter

				// 设置比分平gridview显示与否
				if (info.isShowBFP == false) {
					holderBF.llBFPGridview.setVisibility(View.GONE);
				} else {
					holderBF.llBFPGridview.setVisibility(View.VISIBLE);
				}
				// 按钮的文字
				String[] bfp_titles = new String[] { "0:0", "1:1", "2:2", "3:3", "平其他" };
				String[] bfp_nums;
				bfp_nums = info.sPbfp.split("\\|");//,
				holderBF.bFPGridAdapter = new JczqBfgridviewAdapter(bfp_titles, bfp_nums, context, groups, groupPosition, childPosition, "bfp");
				holderBF.bFPGridview.setAdapter(holderBF.bFPGridAdapter);// 设置菜单Adapter

				// 设置比分主负gridview显示与否
				if (info.isShowBFF == false) {
					holderBF.llBFFGridview.setVisibility(View.GONE);
				} else {
					holderBF.llBFFGridview.setVisibility(View.VISIBLE);
				}
				// 按钮的文字
				String[] bff_titles = new String[] { "0:1", "0:2", "1:2", "0:3", "1:3", "2:3", "0:4", "1:4", "2:4", "0:5", "1:5", "2:5", "负其他" };
				String[] bff_nums;
				bff_nums = info.sPbff.split("\\|");//,
				holderBF.bFFGridAdapter = new JczqBfgridviewAdapter(bff_titles, bff_nums, context, groups, groupPosition, childPosition, "bff");
				holderBF.bFFGridview.setAdapter(holderBF.bFFGridAdapter);// 设置菜单Adapter
			}
		}
//		else if (ZQWF.equals("YZJS")) {
//
//			ChildExpandableListHolderYZJS holderYZJS = null; 
////			if (convertView == null) { // 若行未初始化
//				// 通过flater初始化行视图
//				convertView = mChildInflater.inflate(R.layout.jczq_dgp_item, null);
//				// 并将行视图的5个子视图引用放到tag中
//				holderYZJS = new ChildExpandableListHolderYZJS();
//				holderYZJS.tv_item_no_endtime = (TextView) convertView.findViewById(R.id.tv_item_no_endtime);
//				holderYZJS.tv_matchname = (TextView) convertView.findViewById(R.id.tv_item_match_name);
//				holderYZJS.tv_hteam = (TextView) convertView.findViewById(R.id.tv_item_hteam);
//				holderYZJS.tv_vteam = (TextView) convertView.findViewById(R.id.tv_item_vteam);
//				holderYZJS.btn_s = (Button) convertView.findViewById(R.id.btn_item_s);
//				holderYZJS.btn_p = (Button) convertView.findViewById(R.id.btn_item_p);
//				holderYZJS.btn_f = (Button) convertView.findViewById(R.id.btn_item_f);
//				holderYZJS.btn_rqs = (Button) convertView.findViewById(R.id.btn_item_rqs);
//				holderYZJS.btn_rqp = (Button) convertView.findViewById(R.id.btn_item_rqp);
//				holderYZJS.btn_rqf = (Button) convertView.findViewById(R.id.btn_item_rqf);
//				holderYZJS.btn_rq1 = (Button) convertView.findViewById(R.id.btn_item_rq1);
//				holderYZJS.btn_rq2 = (Button) convertView.findViewById(R.id.btn_item_rq2);
////				convertView.setTag(holderRQSPF);
////			} else { // 若行已初始化，直接从tag属性获得子视图的引用
////				holderRQSPF = (ChildExpandableListHolderRQSPF) convertView.getTag();
////			}
//			// 获得行数据（模型）
//			final ChildDTO info = this.groups.get(groupPosition).children.get(childPosition);
//			if (info != null) {
//				String str_eq = "";
//				String str_nmu = "";
//				// 根据模型数据，设置行视图的控件值
//				if (!info.eQ.equals("0")) {
//					str_eq = info.eQ;
//				}else{
//					str_eq = "-";
//				}
//				if (info.nMm.length() < 4) {
//					str_nmu = info.nMm;
//				} else {
//					str_nmu = info.nMm.substring(0, 4);
//				}
//
////				holderRQSPF.textView_wk.setText(DateUtil.getGameNo(info.mId));
//				//格式修改 130909001  截取后3位001
//				holderYZJS.tv_item_no_endtime.setText(info.mId.substring(info.mId.length()-3, info.mId.length())+" "+DateUtil.getDateTime1(info.eTime));
//				holderYZJS.tv_matchname.setText(str_nmu);
//				
//				holderYZJS.tv_hteam.setText(info.hTeam);
//				holderYZJS.tv_vteam.setText(info.vTeam);
//				if(Integer.valueOf(str_eq) > 0){
//					holderYZJS.btn_rq2.setText("+"+str_eq);
//				}else{
//					holderYZJS.btn_rq2.setText(str_eq);
//				}
//				
//				holderYZJS.btn_rqs.setText("胜" + info.sPRqspf.split("-")[0]);
//				holderYZJS.btn_rqp.setText("平" + info.sPRqspf.split("-")[1]);
//				holderYZJS.btn_rqf.setText("负" + info.sPRqspf.split("-")[2]);
//					if(!info.getsPspf().equals("")){
//						holderYZJS.btn_s.setText("胜" + info.getsPspf().split("-")[0]);
//						holderYZJS.btn_p.setText("平" + info.getsPspf().split("-")[1]);
//						holderYZJS.btn_f.setText("负" + info.getsPspf().split("-")[2]);
//					}else{
//						holderYZJS.btn_s.setText("胜" + "-");
//						holderYZJS.btn_p.setText("平" + "-");
//						holderYZJS.btn_f.setText("负" + "-");
//					}
//
//					holderYZJS.btn_s.setSelected(info.str_sbtn);
//					holderYZJS.btn_s.setTag(info);
//
//					holderYZJS.btn_p.setSelected(info.str_pbtn);
//					holderYZJS.btn_p.setTag(info);
//
//					holderYZJS.btn_f.setSelected(info.str_fbtn);
//					holderYZJS.btn_f.setTag(info);
//					
//					holderYZJS.btn_rqs.setSelected(info.str_rqsbtn);
//					holderYZJS.btn_rqs.setTag(info);
//					
//					holderYZJS.btn_rqp.setSelected(info.str_rqpbtn);
//					holderYZJS.btn_rqp.setTag(info);
//					
//					holderYZJS.btn_rqf.setSelected(info.str_rqfbtn);
//					holderYZJS.btn_rqf.setTag(info);
//
//					holderYZJS.btn_s.setOnClickListener(new View.OnClickListener() {
//					@Override
//					public void onClick(View v) {
//						Button button01 = (Button) v;
//						ChildDTO child_info1 = (ChildDTO) v.getTag();
//						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
//						// 用来装需要删除的彩豆素
//						List delList = new ArrayList();
//						for (ChildDTO child : list_children) {
//							String jc_mid = child.getmId();
//							if (child_info1.getmId() == jc_mid) {
//								delList.add(child);
//							}
//						}
//						list_children.removeAll(delList);
//						// 判断赋新选中的值
//						if (child_info1.str_sbtn) {
//								if(!"".equals(info.getsPspf())){
//									child_info1.setStr_sp(child_info1.str_sp.replace("3," + info.getsPspf().split("-")[0] + "/", ""));
//									child_info1.str_sbtn = false;
//									button01.setSelected(child_info1.str_sbtn);
//									
//								}else{
//								}
//							
//						} else {
//							if (child_info1.str_sp == null) {
//								child_info1.str_sp = "";
//							}
//								if(!"".equals(info.getsPspf())){
//									child_info1.setStr_sp(child_info1.str_sp + "3," + info.getsPspf().split("-")[0] + "/");
//									child_info1.str_sbtn = true;
//									button01.setSelected(child_info1.str_sbtn);
//									
//								}else{
//								}
//								
//						}
//						// 判断str_sp是否为空，空的话就不回传赋值
//						// 再存入List
//						list_children.add(child_info1);
//
//						// 回调initMapData这个方法，转存到全局变量里，选号结束
//						((JcfootballActivity) context).initMapData(list_children,"YZJS");
//
//					}
//				});
//					holderYZJS.btn_p.setOnClickListener(new View.OnClickListener() {
//					@Override
//					public void onClick(View v) {
//						Button button02 = (Button) v;
//						ChildDTO child_info2 = (ChildDTO) v.getTag();
//						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
//						// 用来装需要删除的彩豆素
//						List delList = new ArrayList();
//						for (ChildDTO child : list_children) {
//							String jc_mid = child.getmId();
//							if (child_info2.getmId() == jc_mid) {
//								delList.add(child);
//							}
//						}
//						list_children.removeAll(delList);
//						// 判断赋新的值
//						if (child_info2.str_pbtn) {
//								if(!"".equals(info.getsPspf())){
//									child_info2.setStr_sp(child_info2.str_sp.replace("1," + info.getsPspf().split("-")[1] + "/", ""));
//									child_info2.str_pbtn = false;
//									button02.setSelected(child_info2.str_pbtn);
//									
//								}else{
//								}
//						} else {
//							if (child_info2.str_sp == null) {
//								child_info2.str_sp = "";
//							}
//								if(!"".equals(info.getsPspf())){
//									child_info2.setStr_sp(child_info2.str_sp + "1," + info.getsPspf().split("-")[1] + "/");
//									child_info2.str_pbtn = true;
//									button02.setSelected(child_info2.str_pbtn);
//									
//								}else{
//								}
//						}
//						// 再存入List
//						list_children.add(child_info2);
//						// 回调initMapData这个方法，转存到全局变量里，选号结束
//						((JcfootballActivity) context).initMapData(list_children,"YZJS");
//
//					}
//				});
//					holderYZJS.btn_f.setOnClickListener(new View.OnClickListener() {
//					@Override
//					public void onClick(View v) {
//						Button button03 = (Button) v;
//						ChildDTO child_info3 = (ChildDTO) v.getTag();
//						// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
//						// 用来装需要删除的彩豆素
//						List delList = new ArrayList();
//						for (ChildDTO child : list_children) {
//							String jc_mid = child.getmId();
//							if (child_info3.getmId() == jc_mid) {
//								delList.add(child);
//							}
//						}
//						list_children.removeAll(delList);
//						// 判断赋新的值
//						if (child_info3.str_fbtn) {
//							// child_info3.setStr_sp(child_info3.str_sp.replace("0/",
//							// ""));
//								if(!"".equals(info.getsPspf())){
//									child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.getsPspf().split("-")[2] + "/", ""));
//									child_info3.str_fbtn = false;
//									button03.setSelected(child_info3.str_fbtn);
//									
//								}else{
//								}
////								child_info3.setStr_sp(child_info3.str_sp.replace("0," + info.getsPspf().split("-")[2] + "/", ""));
//
////							child_info3.str_fbtn = false;
////							button03.setSelected(child_info3.str_fbtn);
//						} else {
//							if (child_info3.str_sp == null) {
//								child_info3.str_sp = "";
//							}
//							// child_info3.setStr_sp(child_info3.str_sp + "0/");
//								if(!"".equals(info.getsPspf())){
//									child_info3.setStr_sp(child_info3.str_sp + "0," + info.getsPspf().split("-")[2] + "/");
//									child_info3.str_fbtn = true;
//									button03.setSelected(child_info3.str_fbtn);
//									
//								}else{
//								}
////								child_info3.setStr_sp(child_info3.str_sp + "0," + info.getsPspf().split("-")[2] + "/");
//
////							child_info3.str_fbtn = true;
////							button03.setSelected(child_info3.str_fbtn);
//						}
//						// 再存入List
//						list_children.add(child_info3);
//						// 回调initMapData这个方法，转存到全局变量里，选号结束
//						((JcfootballActivity) context).initMapData(list_children,"YZJS");
//					}
//				});
//					holderYZJS.btn_rqs.setOnClickListener(new View.OnClickListener() {
//						@Override
//						public void onClick(View v) {
//							Button button04 = (Button) v;
//							ChildDTO child_info4 = (ChildDTO) v.getTag();
//							// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
//							// 用来装需要删除的彩豆素
//							List delList = new ArrayList();
//							for (ChildDTO child : list_children) {
//								String jc_mid = child.getmId();
//								if (child_info4.getmId() == jc_mid) {
//									delList.add(child);
//								}
//							}
//							list_children.removeAll(delList);
//							// 判断赋新的值
//							if (child_info4.str_rqsbtn) {
//								
//								if(!"".equals(info.getsPRqspf())){
//									child_info4.setStr_sp(child_info4.str_sp.replace("3," + info.getsPRqspf().split("-")[0] + "/", ""));
//									child_info4.str_rqsbtn = false;
//									button04.setSelected(child_info4.str_rqsbtn);
//									
//								}else{
//								}
//								
//							} else {
//								if (child_info4.str_sp == null) {
//									child_info4.str_sp = "";
//								}
//								child_info4.setStr_sp(child_info4.str_sp + "3," + info.getsPRqspf().split("-")[0] + "/");
//								child_info4.str_rqsbtn = true;
//								button04.setSelected(child_info4.str_rqsbtn);
//							}
//							// 再存入List
//							list_children.add(child_info4);
//							// 回调initMapData这个方法，转存到全局变量里，选号结束
//							((JcfootballActivity) context).initMapData(list_children,"YZJS");
//						}
//					});
//					holderYZJS.btn_rqp.setOnClickListener(new View.OnClickListener() {
//						@Override
//						public void onClick(View v) {
//							Button button05 = (Button) v;
//							ChildDTO child_info5 = (ChildDTO) v.getTag();
//							// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
//							// 用来装需要删除的彩豆素
//							List delList = new ArrayList();
//							for (ChildDTO child : list_children) {
//								String jc_mid = child.getmId();
//								if (child_info5.getmId() == jc_mid) {
//									delList.add(child);
//								}
//							}
//							list_children.removeAll(delList);
//							// 判断赋新的值
//							if (child_info5.str_rqpbtn) {
//								
//								
//								if(!"".equals(info.getsPRqspf())){
//									
//									child_info5.setStr_sp(child_info5.str_sp.replace("1," + info.getsPRqspf().split("-")[1] + "/", ""));
//									child_info5.str_rqpbtn = false;
//									button05.setSelected(child_info5.str_rqpbtn);
//									
//								}else{
//								}
//
//								
//							} else {
//								if (child_info5.str_sp == null) {
//									child_info5.str_sp = "";
//								}
//								child_info5.setStr_sp(child_info5.str_sp + "1," + info.getsPRqspf().split("-")[1] + "/");
//								child_info5.str_rqpbtn = true;
//								button05.setSelected(child_info5.str_rqpbtn);
//			 				}
//							// 再存入List
//							list_children.add(child_info5);
//							// 回调initMapData这个方法，转存到全局变量里，选号结束
//							((JcfootballActivity) context).initMapData(list_children,"YZJS");
//						}
//					});
//					holderYZJS.btn_rqf.setOnClickListener(new View.OnClickListener() {
//						@Override
//						public void onClick(View v) {
//							Button button06 = (Button) v;
//							ChildDTO child_info6 = (ChildDTO) v.getTag();
//							// 当用户点击后，首先从零时List的取出指定mid的赛事，删除掉
//							// 用来装需要删除的彩豆素
//							List delList = new ArrayList();
//							for (ChildDTO child : list_children) {
//								String jc_mid = child.getmId();
//								if (child_info6.getmId() == jc_mid) {
//									delList.add(child);
//								}
//							}
//							list_children.removeAll(delList);
//							// 判断赋新的值
//							if (child_info6.str_rqfbtn) {
//								
//							if(!"".equals(info.getsPRqspf())){
//								
//								child_info6.setStr_sp(child_info6.str_sp.replace("0," + info.getsPRqspf().split("-")[2] + "/", ""));
//								child_info6.str_rqfbtn = false;
//								button06.setSelected(child_info6.str_rqfbtn);
//									
//								}else{
//								}
//
//								
//							} else {
//								if (child_info6.str_sp == null) {
//									child_info6.str_sp = "";
//								}
//								child_info6.setStr_sp(child_info6.str_sp + "0," + info.getsPRqspf().split("-")[2] + "/");
//								child_info6.str_rqfbtn = true;
//								button06.setSelected(child_info6.str_rqfbtn);
//							}
//							// 再存入List
//							list_children.add(child_info6);
//							// 回调initMapData这个方法，转存到全局变量里，选号结束
//							((JcfootballActivity) context).initMapData(list_children,"YZJS");
//						}
//					});
//			}
//		
//			
//		}
		return convertView;
	}

	@Override
	public boolean hasStableIds() {// 行是否具有唯一id
		return false;
	}

	@Override
	public boolean isChildSelectable(int groupPosition, int childPosition) {// 行是否可选
		return true;
	}

}
